const app = getApp();
Page({
	data:{
		g_iphone:'',
    page: 1,
    size: 20
	},
  onLoad: function (options){
    var that = this;
    that.setData({
      options: options
    })
    app.request(app.apiDomain + 'index.php?c=bargain&a=goodsUser&assist_id='+options.assist_id, {}, function (res) {
      if (res.data.status == '1') {
        that.setData({
          assistlist: res.data.data
        });
      }
    });
	},
  scroll_get: function () {
    console.log(111)
    var that = this
    var page = this.data.page + 1
    app.request(app.apiDomain + '/index.php?c=bargain&a=goodsUser&assist_id=' + that.data.options.assist_id + '&page=' + page + '&size=' + that.data.size, {}, res => {
      console.log(res)
      if (res.data.data.length == 0) {
        if (!that.data.isBottom) {
          wx.showToast({
            title: '没有更多了~',
            icon: 'none',
            duration: 2000
          })
        }
        that.setData({
          // page: this.data.page + 1,
          isBottom: true
        })
        return false
      } else if (res.data.data.length < 20) {
        if (!that.data.isBottom) {
          wx.showToast({
            title: '没有更多了~',
            icon: 'none',
            duration: 2000
          })
        }
        that.setData({
          page: this.data.page + 1,
          // 商品列表
          assistlist: this.data.assistlist.concat(res.data.data),
          isBottom: true
        })
        return false
      }
      that.setData({
        page: this.data.page + 1,
        // 商品列表
        goodsList: this.data.goodsList.concat(res.data.data),
        isBottom: false
      })
    })
  },
	onReady:function () {
			app.SystemInfo(this)
	},
  onShareAppMessage: function () {
    var nickName = '';
    var userId = 0;
    try {
      nickName = wx.getStorageSync('nickname');
      userId = wx.getStorageSync('user_id');
    } catch (e) { }
    return {
      title: nickName + '向你推荐趣味答题，挑战通关',
      imageUrl: 'https://resource.160nurse.com/upload/miniprogram/grow.png'
    }
  }  
})



